<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>职位管理</title>
  <link href="../../css/style.css" rel="stylesheet" type="text/css" />
  <script type="text/javascript" src="../../js/jquery.js"></script>
  <script type="text/javascript" src="../../js/api.js"></script>
  <script type="text/javascript" src="../../js/axios.js"></script>
  <script type="text/javascript" src="../../js/commons/messageInfo.js"></script>
  <script type="text/javascript" src="../../js/system/position/positionList.js"></script>
</head>

<body>
  <div class="place"> <span>位置：</span>
    <ul class="placeul">
      <li><a href="../users/userList.html">系统管理</a></li>
      <li><a href="deptList.html">职位管理</a></li>
      <li><a href="#">添加</a></li>
    </ul>
  </div>
  <div class="formbody">
    <div class="formtitle"><span>职位信息</span></div>
    <ul class="forminfo">

      <li>
        <label>职位名称</label>
        <input id="jobName" type="text" class="dfinput""/>
      <i id=" ji"></i>
      </li>
      <li> <label>所属部门：</label>
        <select class="dfselect" id="deptSelect">
        </select>
        <i id="di"></i>
      </li>
      <li>
        <label>&nbsp;</label>
        <input type="button" class="btn" value="确认保存" onclick="save()" />
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input name="" type="button" class="btn" value="返回" onclick="window.history.go(-1);" />
      </li>
    </ul>
  </div>
  <script type="text/javascript">
    appendMsgBox()
    getDept()
    function save() {
      let jobName = $('#jobName').val().trim()
      let deptId = $('#deptSelect').val()
      if(jobName==='') {
        showMessage("请输入职位名称",2000)
        return
      }
      if(deptId==0){
        showMessage("请选择部门",2000)
        return
      }
      let obj = { jobName, jobDeptId:deptId }
      axiosRequest1('post','/job/insert',obj).then((result) => {
        const {data,code,message} = result.data
        showMessage(message,2000)
      }).catch((err) => {
        console.log(err);
      });
    }
  </script>
</body>

</html>